import Vue from "vue";
import Router from "vue-router";
import index from "@/view/index/index.vue"; //引入根目录下的index.vue组件
import menu from "@/view/menu/menu.vue"; // 左侧菜单栏
import list from "@/view/list/list.vue"; // 分类页
import order from "@/view/order/order.vue"; // 订单页
import shop from "@/view/shop/shop.vue"; // 商品页
import user from "@/view/user/user.vue"; // 用户页
import login from "@/view/login/login"; // 登录页
import coupon from "@/view/coupon/coupon"; // 优惠券管理页
import data from "@/view/data-sum/data-sum"; // 数据统计汇总

Vue.use(Router);

export const constantRouterMap = [
  {
    path: "/",
    component: index,
    children: [
      {
        path: "/",
        component: () => import("@/view/index/index"),
      },
    ],
  },
  {
    path: "/menu/menu",
    component: menu,
    children: [
      {
        path: "menu",
        name: "菜单栏",
        component: () => import("@/view/menu/menu"),
      },
    ],
  },
  {
    path: "/list/list",
    component: list,
    children: [
      {
        path: "list",
        name: "分类管理",
        component: () => import("@/view/list/list"),
      },
    ],
  },
  {
    path: "/order/order",
    component: order,
    children: [
      {
        path: "order",
        name: "订单管理",
        component: () => import("@/view/order/order"),
      },
    ],
  },
  {
    path: "/shop/shop",
    component: shop,
    children: [
      {
        path: "shop",
        name: "商品管理",
        component: () => import("@/view/shop/shop"),
      },
    ],
  },
  {
    path: "/user/user",
    component: user,
    children: [
      {
        path: "user",
        name: "用户管理",
        component: () => import("@/view/user/user"),
      },
    ],
  },
  {
    path: "/coupon/coupon",
    component: coupon,
    children: [
      {
        path: "coupon",
        name: "优惠券管理",
        component: () => import("@/view/coupon/coupon"),
      },
    ],
  },
  {
    path: "/data/data",
    component: data,
    children: [
      {
        path: "data",
        name: "数据统计汇总",
        component: () => import("@/view/data-sum/data-sum"),
      },
    ],
  },
  {
    path: "/login/login",
    component: login,
    children: [
      {
        path: "login",
        name: "登录",
        component: () => import("@/view/login/login"),
      },
    ],
  },
];

const router = new Router({
  routes: constantRouterMap,
});

export default router;
